#include "stackplatewid.h"
#include "componentmanager.h"
#include "stackplate\stackplatemanager.h"
#include "stackplateinfowid.h"

StackPlateWid::StackPlateWid(QWidget* parent)
	: QWidget(parent)
{
	ui.setupUi(this);
}

StackPlateWid::~StackPlateWid()
{}

bool StackPlateWid::Init()
{
	auto platem = dynamic_cast<StackPlateManager*>(component->GetComponent(Component::component_stackPlate));
	if (platem == nullptr) {
		return false;
	}

	auto plates = platem->GetPlateList();
	if (plates.size() <= 0) {
		return false;
	}
	for (auto iter : plates) {
		auto temp = new StackPlateInfoWid(this);
		temp->Init(iter);
		ui.tabWidget->addTab(temp, iter->GetPlateId());
	}
	return true;
}
